package edu.chinasoft.domain;

import java.util.ArrayList;
import java.util.List;

public class PageUnitForUser {
	private List<User> userList = new ArrayList<User>();
	private int pageUnit;
	private int pageNum;
	private int recordNum;
	private int currentPage;

	public PageUnitForUser() {
	}

	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}

	public int getPageUnit() {
		return pageUnit;
	}

	public void setPageUnit(int pageUnit) {
		this.pageUnit = pageUnit;
	}

	public int getPageNum() {
		int result = (recordNum-1)/pageUnit+1;
		return result;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getRecordNum() {
		return recordNum;
	}

	public void setRecordNum(int recordNum) {
		this.recordNum = recordNum;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPrePage() {
		int result = this.currentPage-1;
		result = result<1?1:result;
		return result;
	}

	public int getNextPage() {
		int result = this.currentPage+1;
		result = result>this.getPageNum()?this.getPageNum():result;
		return result;
	}

	@Override
	public String toString() {
		return "PageUnitForDept{" +
				"goodsList=" + userList +
				", pageUnit=" + pageUnit +
				", pageNum=" + pageNum +
				", recordNum=" + recordNum +
				", currentPage=" + currentPage +
				'}';
	}
}
